from ultralytics import YOLO

def main():
    # Load a model
    model = YOLO('ultralytics/weights/yolov8s.pt')  # load a pretrained model (recommended for training)

    # Train the model
    results = model.train(
        data='ultralytics/ultralytics/cfg/datasets/VOC-tt100k.yaml',
        epochs=300,
        imgsz=640,
        batch=8,
        workers=4,
        patience=150,
        device=0,
        name='train_yolov8s'
    )

if __name__ == '__main__':
    main()
